package net.ck.hzq;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import model.BusinessmanagementFragmentPagerAdapter;

public class BusinessmanagementActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView businessmanagement_back;

    private TabLayout mTabLayout;
    private ViewPager mViewPager;

    private BusinessmanagementFragmentPagerAdapter businessmanagementFragmentPagerAdapter;

    private TabLayout.Tab one;
    private TabLayout.Tab two;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_businessmanagement);

        findViewById(R.id.iv_back).setOnClickListener(this);

        findViewById(R.id.t_pos_layout).setOnClickListener(v -> {
            Intent intent = new Intent(this, PosRecordActivity.class);
            intent.putExtra("type", "2");
            startActivity(intent);
        });

        findViewById(R.id.m_pos_layout).setOnClickListener(v -> {
            Intent intent = new Intent(this, PosRecordActivity.class);
            intent.putExtra("type", "1");
            startActivity(intent);
        });
    }

//    private void initViews() {
//
//        businessmanagement_back = (ImageView) findViewById(R.id.businessmanagement_back);
//
//        //使用适配器将ViewPager与Fragment绑定在一起
//        mViewPager = (ViewPager) findViewById(R.id.viewPager_businessmanagement);
//        businessmanagementFragmentPagerAdapter = new BusinessmanagementFragmentPagerAdapter(getSupportFragmentManager());
//        mViewPager.setAdapter(businessmanagementFragmentPagerAdapter);
//
//        //将TabLayout与ViewPager绑定在一起
//        mTabLayout = (TabLayout) findViewById(R.id.tabLayout_businessmanagement);
//        mTabLayout.setupWithViewPager(mViewPager);
//
//        //指定Tab的位置
//        one = mTabLayout.getTabAt(0);
//        two = mTabLayout.getTabAt(1);
//
//        one.setText("终端列表");
//        two.setText("商户拓展");
//
//        businessmanagement_back.setOnClickListener(this);
//    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }


}
